package com.rfs.suanfa;

import java.util.ArrayList;
import java.util.List;

public class 找到所有数组中消失的数字 {
    public static void main(String[] args) {

    }
    public static List<Integer> findDisappearedNumbers(int[] nums) {
        boolean[] counter=new boolean[nums.length+1];
        for (int num : nums) {
            counter[num]=true;
        }
        List<Integer> result=new ArrayList<>();
        for (int i = 1; i < counter.length; i++) {
            if (!counter[i]) {
                result.add(i);
            }
        }
        return result;
    }
}
